package com.platform.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.server.service.DiscountService;

@Controller
@RequestMapping("/discount")
public class DiscountController {
	
	@Autowired
	private DiscountService discountService;
	
	/**
	 * 我的优惠券
	 */
	@ResponseBody
	@RequestMapping(value = "/selectMyDiscount",method = RequestMethod.POST)
	public Object selectMyDiscount(String id,Integer pageSize, Integer pageNo){
		if(pageSize==null||pageNo==null){
            pageNo =1;
            pageSize = 10;
        }
		return discountService.selectMyDiscount(id,pageSize,pageNo);
	}
	
	/**
	 * 已使用的优惠券
	 */
	@ResponseBody
	@RequestMapping(value = "/selectUseDiscount",method = RequestMethod.POST)
	public Object selectUseDiscount(String userid,Integer pageSize, Integer pageNo){
		if(pageSize==null||pageNo==null){
            pageNo =1;
            pageSize = 10;
        }
		return discountService.selectUseDiscount(userid,pageSize,pageNo);
	}
}
